package com.cqie.hospitalescort.controller;

import com.cqie.hospitalescort.DTO.EscortDTO;
import com.cqie.hospitalescort.controller.params.EscortParam;
import com.cqie.hospitalescort.entity.EscortInfo;
import com.cqie.hospitalescort.model.Result;
import com.cqie.hospitalescort.service.EscortInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * 陪诊人员表 前端控制器
 * </p>
 *
 * @author gdy
 * @since 2025-02-18
 */
@RestController
@RequestMapping("/escort")
@Api(value = "陪诊员", tags = {"陪诊员"})
public class EscortInfoController extends BaseController {

    @Autowired
    private EscortInfoService escortInfoService;

    @PostMapping("/list")
    @ApiOperation(value = "陪诊员列表")
    public Result<List<EscortInfo>> getList(@RequestBody EscortParam param) {

        return response(escortInfoService.getList(param));
    }

    @PostMapping("/save")
    @ApiOperation(value = "更新陪诊员")
    public Result<Void> save(@RequestBody @Validated EscortDTO dto) {
        escortInfoService.save(dto);
        return response();
    }

    @DeleteMapping("/delete")
    @ApiOperation(value = "删除陪诊员")
    public Result<Void> delete(@RequestParam Long id) {
        escortInfoService.delete(id);
        return response();
    }

    @GetMapping("/getScore")
    @ApiOperation(value = "查询积分值")
    public Result<?> getScore(@RequestParam Long id) {

        return response(escortInfoService.getScore(id));
    }

}
